package org.vectrics.recruiter.user;


import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.vectrics.user.*;

import org.apache.log4j.Category;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.user.Resume;
import org.vectrics.recruiter.job.Job;
import org.vectrics.recruiter.job.JobCandidate;
import org.vectrics.DataException;


public class RecruitUserManager  {
	private static Category log = Category.getInstance(RecruitUserProfile.class);
    private User user = null;
    


	public Resume findResume(Long resumeId){
		Resume resume = RecruitServiceLocator.getRecruitUserService().findResume(resumeId);
		return(resume);
	}
/*	
    
    public static String getResumeText(User user) throws DataException {
    	Resume resume = null;
    	String resumeText = null;
    	try {
    		resume = recruitUserPersistMgr.getLatestResume(user.getId());
    		if (resume != null) {
    			resumeText = resume.getEntireResume();
    		}
    	}
    	catch (Exception ex) {
    		log.error("getResume() exception", ex);
			throw new DataException("getResumeText() exception", ex);
    	}
    	return(resumeText);
    }



	public static void setResumeText(User user, String text) throws DataException {
		try {
			log.debug("setResumeText() called");
			if (user == null) {
				throw new DataException("User not given in setResumeText()");
			}
			recruitUserPersistMgr.saveUserResumeText(user.getId(), text);
		}
		catch (Exception ex) {
			log.error("setResumeText() exception", ex);
			throw new DataException("setResumeText() exception", ex);
		}
	}
*/    
	public List findResumeIds(int maxDaysOld, Collection functionalAreas) throws DataException {
		List resumeIds = RecruitServiceLocator.getRecruitUserService().findResumeIds(maxDaysOld, functionalAreas);
		return(resumeIds);
	}
	
	public Collection getUserSkillSet() {
		Collection userSkillSet = null;
		// TODO
		return(userSkillSet);
	}    
	
	public Interview findInterviewById(Long interviewId) {
		Interview interview = null;
		try {
			interview = RecruitServiceLocator.getRecruitUserService().findInterviewById(interviewId);
		}
		catch (Exception ex) {
			log.error("findInterviewById() - exception", ex);
		}
		return(interview);
	}
	
	public void updateInterview(Interview interview) {
		try {
			RecruitServiceLocator.getRecruitUserService().updateInterview(interview);
		}
		catch (DataException ex) {
			log.error("updateInterview() - exception", ex);
		}
	}
	
	public void removeInterview(Interview interview) throws DataException {
		try {
			RecruitServiceLocator.getRecruitUserService().removeInterview(interview);
		}
		catch (DataException ex) {
			log.error("removeInterview() - exception", ex);
			throw new DataException("removeInterview() - exception", ex);
		}
	}

	public Interview createInterview(JobCandidate jobCandidate) {
		Interview newInterview = null;
		try {
			newInterview = RecruitServiceLocator.getRecruitUserService().createInterview(jobCandidate, jobCandidate.getJob().getPrimaryRecruiter());
		}
		catch (DataException ex) {
			log.error("updateInterview() - exception", ex);
		}
		return(newInterview);
	}




/*
	
	
	public CandidateInfo findCandidateInfo(User user) throws DataException {
		CandidateInfo candidateInfo = RecruitServiceLocator.getRecruitUserProvider().findCandidateInfo(user.getId());
		return(candidateInfo);
	}

	
	public CandidateInfo getCreateCandidateInfo(User user) throws DataException {
		log.debug("getCreateCandidateInfo()");
		CandidateInfo candidateInfo = RecruitServiceLocator.getRecruitUserProvider().getCreateCandidateInfo(user);
		return(candidateInfo);
	}

*/
};
